# -*- coding: UTF-8 -*-

def get_active_text(combobox):
	model = combobox.get_model()
	active = combobox.get_active()
	if active < 0:
		return None
	return model[active][0]

def get_index_element(combo,name):
	model = combo.get_model()
	treeiter = model.get_iter_first()
	index=0
	while True:
		try:
			val = model.get_value(treeiter, 0)
			if val == name:
				break
		
			index=index+1
			treeiter = model.iter_next(treeiter)
		except:
			return None

	return index
